<template>
<div class="vue-box sbot">
  <!-- ------- 内容部分 ------- -->
  <div class="c-panel">
    <el-form v-if="m" :inline="true">
      <sa-info name="序号" br>{{ m.id }}</sa-info>
      <sa-info type="text" name="资源名" :value="m.name" br></sa-info>
      <sa-info type="text" name="简称" :value="m.segmentName" br></sa-info>
      <sa-info type="text" name="识别码" :value="m.code" br></sa-info>
      <sa-info type="enum" name="资源类别" :jv="dims.RESOURCE_CATEGORY" :value="m.category" br />
      <sa-info type="enum" name="资源类型" :jv="dims.RESOURCE_TYPE" :value="m.type" br />
      <sa-info name="所属标签" br>
        <template>
          <div class="stags">
            <el-tag effect="plain" type="primary" v-for="(k, v) in dims.TAGS" :key="v" v-if="parseTag(m.tags, v)">
              {{ k }}
            </el-tag>
          </div>
        </template>
      </sa-info>
      <sa-info type="link" name="资源地址" :value="m.url" br />
      <sa-info type="text" name="点击量" :value="m.clickNum" br />
      <sa-info type="img-list" name="资源图标" :value="m.img" br />
      <sa-info type="img-list" name="缩略图" :value="m.thumbnail" br />
      <sa-info type="enum" name="审核状态" :jv="dims.AUDIT_STATUS" :value="m.auditStatus" br />
      <sa-info type="enum" name="启用状态" :jv="dims.YES_OR_NO" :value="m.status" br />
      <sa-info name="描述" br>{{ m.note }}</sa-info>
    </el-form>
  </div>
</div>
</template>

<script>
import tagFunc from '@/mixins/tag';
export default {
  name: 'rsr-info',
  props: {
    param: Object
  },
  mixins: [tagFunc],
  data() {
    return {
      id: this.param.id,
      dims: sa.$sys.getCurd(),
      sa: sa,
      m: {},
    }
  },
  created: function () {
    sa.ajax('/rsr/getById', {
      id: this.id
    }, function (res) {
      this.m = res.data;
    }.bind(this), {
      type: "get"
    });
  },
  methods: {}
}
</script>

<style scoped>
.stags {
  display: flex;
  justify-content: start;

  span {
    margin-left: 2px;
  }
}
</style>
